import request from '@/config/axios'

// 会员等级对应权益 VO
export interface BenifitVO {
  id: number // 主键自增ID
  levelId: number // 等级ID
  sort: number //排序规则
  name: string // 权益名称
  content: string // 权益内容
  icon: string // 权益显示图标
  backgroundUrl: string // 背景图片
  status: number // 状态 0开启 1关闭
}

// 会员等级对应权益 API
export const BenifitApi = {
  // 查询会员等级对应权益分页
  getBenifitPage: async (params: any) => {
    return await request.get({ url: `/member/benifit/page`, params })
  },

  // 查询会员等级对应权益详情
  getBenifit: async (id: number) => {
    return await request.get({ url: `/member/benifit/get?id=` + id })
  },

  // 新增会员等级对应权益
  createBenifit: async (data: BenifitVO) => {
    return await request.post({ url: `/member/benifit/create`, data })
  },

  // 修改会员等级对应权益
  updateBenifit: async (data: BenifitVO) => {
    return await request.put({ url: `/member/benifit/update`, data })
  },

  // 删除会员等级对应权益
  deleteBenifit: async (id: number) => {
    return await request.delete({ url: `/member/benifit/delete?id=` + id })
  },

  // 导出会员等级对应权益 Excel
  exportBenifit: async (params) => {
    return await request.download({ url: `/member/benifit/export-excel`, params })
  }
}